import { Command, logger, ModeOptions, createServer } from "f2e-server3"

const app = new Command()
    .option('-m, --mode <mode>', 'server mode: dev, build or prod', 'dev', ModeOptions)
    .action(async (options) => {
        const { mode } = options
        logger.setLevel('DEBUG')
        createServer({
            mode, port: 9999,
            gzip: true,
            buildFilter: pathname => /^(index|$)/.test(pathname),
            watchFilter: pathname => /^(index|src|$)/.test(pathname),
            outputFilter: pathname => /^(index|static|$)/.test(pathname),
            try_files: 'index.html',
        })
    })

app.parse(process.argv)